package com.demo.msg;

import com.jfinal.kit.StringKit;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import java.util.List;

@SuppressWarnings("serial")
public class Msgtype extends Model<Msgtype>{
    public static final Msgtype dao = new Msgtype();


    public List<Msgtype> findAll() {
        return find("select * from wx_msgtype");
    }

    public List<Record> findAlls(String where) {
        String sql="  from wx_msgtype ";
        if(StringKit.notBlank(where)){
            sql += " where " + where;
        }
        return  Db.find( "select * " + sql) ;
    }

    public Page<Msgtype> page(int pageNumber, int pageSize, String where) {
        String sqlExp = "from wx_msgtype";
        if(StringKit.notBlank(where)){
            sqlExp += " where " + where;
        }
        String order="  order by yxbz desc";
        return paginate(pageNumber, pageSize, "select *", sqlExp+order);
    }
}

